package operation;

import book.BookList;

import java.util.Scanner;

public class ReturnOperation implements IOperation{
    @Override
    public void work(BookList booklist) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要归还的图书:");
        String name = scanner.nextLine();
        int currentSize = booklist.getUsedSize();
        for (int i = 0; i < currentSize; i++) {
            if(booklist.findBook(i).getName().equals(name)) {
                booklist.findBook(i).setBorrowed(false);
                System.out.println("归还成功！");
                System.out.println("--------------------------------------");                break;
            }
        }
    }
}
